package com.liruo.learn.spring.security.auth.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author:liruo
 * @Date:2023-05-18-19:30:57
 * @Desc
 */
@Slf4j
public class FormAuthenticationFailureHandler implements AuthenticationFailureHandler {
    @Override
    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
        log.info("{}, request={}\n, parameterMap={}\n, err={}",
                this.getClass().getSimpleName(),
                request.getRequestURI(),
                request.getParameterMap(),
                exception);
    }
}
